feat: add Copy Failing Tests Output command with stack traces#676
Open
BLamy wants to merge 4 commits intovitest-dev:mainfrom
Open
feat: add Copy Failing Tests Output command with stack traces#676BLamy wants to merge 4 commits intovitest-dev:mainfrom
BLamy wants to merge 4 commits intovitest-dev:mainfrom
Conversation
- Add TestResult interface to track test results (status, messages, duration, timestamp) - Extend TestCase class with lastResult property and setResult() method - Update TestRunner.markTestCase() to persist test results in TestCase instances - Add TestTree.getFailingTests() to collect all failing tests - Add vitest.copyFailingTestsOutput command that: - Collects all failing tests from the test tree - Formats output with test name, file path, duration, error messages, and stack traces - Copies formatted output to clipboard - Shows notification with count of failing tests - Register command in package.json and testing/item/context menu Co-authored-by: Ona <no-reply@ona.com>
- Read source files to display code context around errors
- Show 2 lines before and after the error line
- Add line numbers with 4-digit padding
- Add arrow (>) to highlight the error line
- Add caret (^) pointer to exact column position
- Include error message inline with the pointer
- Fallback to simple location if file cannot be read
Example output:
at functionName (file.ts:41:19)
39 | // Check that the page has a title
40 | const title = await page.title();
> 41 | expect(title).toBeTruthy();
| ^ expected undefined to be true
Co-authored-by: Ona <no-reply@ona.com>
Co-authored-by: Ona <no-reply@ona.com>
- Exclude .pnpm-store directory - Exclude .devcontainer directory - Exclude tsconfig.tsbuildinfo - Exclude packages node_modules, src, and tsconfig.json This reduces the VSIX package size from 388MB to 629KB. Co-authored-by: Ona <no-reply@ona.com>
sheremet-va
requested changes
Oct 30, 2025
| const tokenSource = new vscode.CancellationTokenSource() | ||
| await profile.runHandler(request, tokenSource.token) | ||
| }), | ||
| vscode.commands.registerCommand('vitest.copyFailingTestsOutput', async () => { |
Member
There was a problem hiding this comment.
I am confused why you don't use the test item here to get the errors from there? With this implementation, the copy button will copy all errors whenever you call this
This was referenced Jan 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make it so I can copy the test output in a format consumable by an LLM
Example Output